home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MPW Oberon 2.1168 / OInterfaces / Perf.mod < prev    next >
Encoding:
Text File  |  1995-08-10  |  3.1 KB  |  94 lines  |  [TEXT/MPS ]

  1. (*
  2.     File:        Perf.mod
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. *)
  11.  
  12. (*$TAGS-*)
  13. (*$CALLING PASCAL*)
  14. MODULE Perf;
  15.  
  16. IMPORT SYSTEM, Types;
  17.  
  18. TYPE
  19.  
  20. PLongs* = POINTER TO ALongs;
  21. ALongs* = ARRAY 8001 (*ΔΔ[1..8000]ΔΔ*) OF LONGINT;
  22.  
  23. PInts* = POINTER TO AInts;
  24. HInts* = HANDLE TO AInts (*ΔΔ POINTER TO PInts*);
  25.  
  26. AInts* = ARRAY 8001 (*ΔΔ[1..8000]ΔΔ*) OF INTEGER;
  27.  
  28. (* PerfGlobals are declared as a record, so main program can allocate
  29. as globals, desk accessory can add to globals allocated via pointer,
  30. print driver can allocate via low memory, etc. *)
  31.  
  32.  
  33. TP2PerfGlobals* = POINTER TO TPerfGlobals;
  34. TPerfGlobals* = RECORD
  35.     startROM*: LONGINT;            (*ROM Base*)
  36.     romHits*: LONGINT;            (*used if MeasureROM is false*)
  37.     misses*: LONGINT;            (*count of PC values outside measured memory*)
  38.     segArray*: PLongs;            (*array of segment handles*)
  39.     sizeArray*: PLongs;            (*array of segment sizes*)
  40.     idArray*: HInts;             (*array of segment rsrc IDs*)
  41.     baseArray*: PLongs;            (*array of offsets to counters for each segment*)
  42.     samples*: PLongs;            (*samples buffer*)
  43.     buffSize*: LONGINT;            (*size of samples buffer in bytes*)
  44.     timeInterval*: INTEGER;        (*number of clock intervals between interrupts*)
  45.     bucketSize*: INTEGER;        (*size of buckets power of 2*)
  46.     log2buckSize*: INTEGER;        (*used in CvtPC*)
  47.     pcOffset*: INTEGER;            (*offset to the user PC at interrupt time.*)
  48.     numMeasure*: INTEGER;        (*# Code segments (w/o jump table)- ROM etc.*)
  49.     firstCode*: INTEGER;         (*index of first Code segment*)
  50.     takingSamples*: BOOLEAN;     (*true if sampling is enabled*)
  51.     measureROM*: BOOLEAN;
  52.     measureCode*: BOOLEAN;
  53.     ramSeg*: INTEGER;            (*index of "segment" record to cover RAM > 0 if RAM (misses) are to be bucketed.*)
  54.     ramBase*: LONGINT;            (*beginning of RAM being measured.*)
  55.     measureRAMbucketSize*: INTEGER;
  56.     measureRAMlog2buckSize*: INTEGER;
  57.     romVersion*: INTEGER;
  58.     vRefNum*: INTEGER;            (*Volume where the report file is to be created*)
  59.     volumeSelected*: BOOLEAN;    (*True if user selects the report file name*)
  60.     rptFileName*: Types.Str255;        (*Report file name*)
  61.     rptFileCreator*: Types.Str255;     (*Report File Creator*)
  62.     rptFileType*: Types.Str255;        (*Report File type*)
  63.     getResType*: Types.ResType;        (*Resource type*)
  64.     END;
  65.  
  66.  
  67.  
  68. PROCEDURE InitPerf*(VAR thePerfGlobals: TP2PerfGlobals;timerCount: INTEGER;
  69.     codeAndROMBucketSize: INTEGER;doROM: BOOLEAN;doAppCode: BOOLEAN;appCodeType: Types.Str255;
  70.     romID: INTEGER;romName: Types.Str255;doRAM: BOOLEAN;ramLow: LONGINT;ramHigh: LONGINT;
  71.     ramBucketSize: INTEGER): BOOLEAN;
  72.     EXTERNAL PASCAL;
  73. (* called once to setup Performance monitoring
  74.  *)
  75.  
  76. PROCEDURE TermPerf*(thePerfGlobals: TP2PerfGlobals);
  77.     EXTERNAL PASCAL;
  78. (* if InitPerf succeeds then TermPerf must be called before terminating program.
  79.  *)
  80.  
  81. PROCEDURE PerfControl*(thePerfGlobals: TP2PerfGlobals;turnOn: BOOLEAN): BOOLEAN;
  82.     EXTERNAL PASCAL;
  83. (* Call this to turn off/on measuring.
  84.  Returns previous state.
  85.  *)
  86.  
  87. PROCEDURE PerfDump*(thePerfGlobals: TP2PerfGlobals;reportFile: Types.Str255;doHistogram: BOOLEAN;
  88.     rptFileColumns: INTEGER): INTEGER;
  89.     EXTERNAL PASCAL;
  90. (* Call this to dump the statistics into a file. *)
  91.  
  92.  
  93.     END Perf.
  94.